{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Evidently LLM tracing tutorial"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "6NlE0ZzoQMto",
    "outputId": "b28cab4d-08df-49d7-b99d-dfdadaee4fab"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting evidently\n",
      "  Downloading evidently-0.4.33-py3-none-any.whl.metadata (11 kB)\n",
      "Requirement already satisfied: plotly>=5.10.0 in /usr/local/lib/python3.10/dist-packages (from evidently) (5.15.0)\n",
      "Requirement already satisfied: statsmodels>=0.12.2 in /usr/local/lib/python3.10/dist-packages (from evidently) (0.14.2)\n",
      "Requirement already satisfied: scikit-learn>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from evidently) (1.3.2)\n",
      "Requirement already satisfied: pandas>=1.3.5 in /usr/local/lib/python3.10/dist-packages (from pandas[parquet]>=1.3.5->evidently) (2.1.4)\n",
      "Requirement already satisfied: numpy>=1.22.0 in /usr/local/lib/python3.10/dist-packages (from evidently) (1.26.4)\n",
      "Requirement already satisfied: nltk>=3.6.7 in /usr/local/lib/python3.10/dist-packages (from evidently) (3.8.1)\n",
      "Requirement already satisfied: scipy>=1.10.0 in /usr/local/lib/python3.10/dist-packages (from evidently) (1.13.1)\n",
      "Collecting requests>=2.32.0 (from evidently)\n",
      "  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)\n",
      "Requirement already satisfied: PyYAML>=5.4 in /usr/local/lib/python3.10/dist-packages (from evidently) (6.0.1)\n",
      "Requirement already satisfied: pydantic>=1.10.13 in /usr/local/lib/python3.10/dist-packages (from evidently) (2.8.2)\n",
      "Collecting litestar>=2.8.3 (from evidently)\n",
      "  Downloading litestar-2.10.0-py3-none-any.whl.metadata (103 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m103.1/103.1 kB\u001b[0m \u001b[31m920.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hCollecting typing-inspect>=0.9.0 (from evidently)\n",
      "  Downloading typing_inspect-0.9.0-py3-none-any.whl.metadata (1.5 kB)\n",
      "Collecting uvicorn>=0.22.0 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading uvicorn-0.30.5-py3-none-any.whl.metadata (6.6 kB)\n",
      "Collecting watchdog>=3.0.0 (from evidently)\n",
      "  Downloading watchdog-4.0.1-py3-none-manylinux2014_x86_64.whl.metadata (37 kB)\n",
      "Requirement already satisfied: typer>=0.3 in /usr/local/lib/python3.10/dist-packages (from evidently) (0.12.3)\n",
      "Requirement already satisfied: rich>=13 in /usr/local/lib/python3.10/dist-packages (from evidently) (13.7.1)\n",
      "Collecting iterative-telemetry>=0.0.5 (from evidently)\n",
      "  Downloading iterative_telemetry-0.0.8-py3-none-any.whl.metadata (4.1 kB)\n",
      "Collecting dynaconf>=3.2.4 (from evidently)\n",
      "  Downloading dynaconf-3.2.6-py2.py3-none-any.whl.metadata (9.1 kB)\n",
      "Requirement already satisfied: certifi>=2024.7.4 in /usr/local/lib/python3.10/dist-packages (from evidently) (2024.7.4)\n",
      "Requirement already satisfied: urllib3>=1.26.19 in /usr/local/lib/python3.10/dist-packages (from evidently) (2.0.7)\n",
      "Requirement already satisfied: fsspec>=2024.2.0 in /usr/local/lib/python3.10/dist-packages (from evidently) (2024.6.1)\n",
      "Collecting ujson>=5.4.0 (from evidently)\n",
      "  Downloading ujson-5.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (9.3 kB)\n",
      "Collecting opentelemetry-api>=1.25.0 (from evidently)\n",
      "  Downloading opentelemetry_api-1.26.0-py3-none-any.whl.metadata (1.4 kB)\n",
      "Collecting opentelemetry-sdk>=1.25.0 (from evidently)\n",
      "  Downloading opentelemetry_sdk-1.26.0-py3-none-any.whl.metadata (1.5 kB)\n",
      "Collecting opentelemetry-proto>=1.25.0 (from evidently)\n",
      "  Downloading opentelemetry_proto-1.26.0-py3-none-any.whl.metadata (2.3 kB)\n",
      "Collecting opentelemetry-exporter-otlp-proto-grpc>=1.25.0 (from evidently)\n",
      "  Downloading opentelemetry_exporter_otlp_proto_grpc-1.26.0-py3-none-any.whl.metadata (2.3 kB)\n",
      "Collecting opentelemetry-exporter-otlp-proto-http>=1.25.0 (from evidently)\n",
      "  Downloading opentelemetry_exporter_otlp_proto_http-1.26.0-py3-none-any.whl.metadata (2.3 kB)\n",
      "Collecting appdirs (from iterative-telemetry>=0.0.5->evidently)\n",
      "  Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)\n",
      "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from iterative-telemetry>=0.0.5->evidently) (3.15.4)\n",
      "Requirement already satisfied: distro in /usr/lib/python3/dist-packages (from iterative-telemetry>=0.0.5->evidently) (1.7.0)\n",
      "Requirement already satisfied: anyio>=3 in /usr/local/lib/python3.10/dist-packages (from litestar>=2.8.3->evidently) (3.7.1)\n",
      "Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from litestar>=2.8.3->evidently) (8.1.7)\n",
      "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from litestar>=2.8.3->evidently) (1.2.2)\n",
      "Collecting httpx>=0.22 (from litestar>=2.8.3->evidently)\n",
      "  Downloading httpx-0.27.0-py3-none-any.whl.metadata (7.2 kB)\n",
      "Collecting msgspec>=0.18.2 (from litestar>=2.8.3->evidently)\n",
      "  Downloading msgspec-0.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.9 kB)\n",
      "Requirement already satisfied: multidict>=6.0.2 in /usr/local/lib/python3.10/dist-packages (from litestar>=2.8.3->evidently) (6.0.5)\n",
      "Collecting polyfactory>=2.6.3 (from litestar>=2.8.3->evidently)\n",
      "  Downloading polyfactory-2.16.2-py3-none-any.whl.metadata (27 kB)\n",
      "Collecting rich-click (from litestar>=2.8.3->evidently)\n",
      "  Downloading rich_click-1.8.3-py3-none-any.whl.metadata (7.9 kB)\n",
      "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from litestar>=2.8.3->evidently) (4.12.2)\n",
      "Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk>=3.6.7->evidently) (1.4.2)\n",
      "Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.10/dist-packages (from nltk>=3.6.7->evidently) (2024.5.15)\n",
      "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from nltk>=3.6.7->evidently) (4.66.4)\n",
      "Collecting deprecated>=1.2.6 (from opentelemetry-api>=1.25.0->evidently)\n",
      "  Downloading Deprecated-1.2.14-py2.py3-none-any.whl.metadata (5.4 kB)\n",
      "Collecting importlib-metadata<=8.0.0,>=6.0 (from opentelemetry-api>=1.25.0->evidently)\n",
      "  Downloading importlib_metadata-8.0.0-py3-none-any.whl.metadata (4.6 kB)\n",
      "Requirement already satisfied: googleapis-common-protos~=1.52 in /usr/local/lib/python3.10/dist-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->evidently) (1.63.2)\n",
      "Requirement already satisfied: grpcio<2.0.0,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->evidently) (1.64.1)\n",
      "Collecting opentelemetry-exporter-otlp-proto-common==1.26.0 (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->evidently)\n",
      "  Downloading opentelemetry_exporter_otlp_proto_common-1.26.0-py3-none-any.whl.metadata (1.8 kB)\n",
      "Requirement already satisfied: protobuf<5.0,>=3.19 in /usr/local/lib/python3.10/dist-packages (from opentelemetry-proto>=1.25.0->evidently) (3.20.3)\n",
      "Collecting opentelemetry-semantic-conventions==0.47b0 (from opentelemetry-sdk>=1.25.0->evidently)\n",
      "  Downloading opentelemetry_semantic_conventions-0.47b0-py3-none-any.whl.metadata (2.4 kB)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.3.5->pandas[parquet]>=1.3.5->evidently) (2.8.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.3.5->pandas[parquet]>=1.3.5->evidently) (2024.1)\n",
      "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.3.5->pandas[parquet]>=1.3.5->evidently) (2024.1)\n",
      "Requirement already satisfied: pyarrow>=7.0.0 in /usr/local/lib/python3.10/dist-packages (from pandas[parquet]>=1.3.5->evidently) (14.0.2)\n",
      "Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly>=5.10.0->evidently) (9.0.0)\n",
      "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from plotly>=5.10.0->evidently) (24.1)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic>=1.10.13->evidently) (0.7.0)\n",
      "Requirement already satisfied: pydantic-core==2.20.1 in /usr/local/lib/python3.10/dist-packages (from pydantic>=1.10.13->evidently) (2.20.1)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.0->evidently) (3.3.2)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.0->evidently) (3.7)\n",
      "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.10/dist-packages (from rich>=13->evidently) (3.0.0)\n",
      "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from rich>=13->evidently) (2.16.1)\n",
      "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=1.0.1->evidently) (3.5.0)\n",
      "Requirement already satisfied: patsy>=0.5.6 in /usr/local/lib/python3.10/dist-packages (from statsmodels>=0.12.2->evidently) (0.5.6)\n",
      "Requirement already satisfied: shellingham>=1.3.0 in /usr/local/lib/python3.10/dist-packages (from typer>=0.3->evidently) (1.5.4)\n",
      "Collecting mypy-extensions>=0.3.0 (from typing-inspect>=0.9.0->evidently)\n",
      "  Downloading mypy_extensions-1.0.0-py3-none-any.whl.metadata (1.1 kB)\n",
      "Collecting h11>=0.8 (from uvicorn>=0.22.0->uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)\n",
      "Collecting httptools>=0.5.0 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading httptools-0.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.6 kB)\n",
      "Collecting python-dotenv>=0.13 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)\n",
      "Collecting uvloop!=0.15.0,!=0.15.1,>=0.14.0 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading uvloop-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.9 kB)\n",
      "Collecting watchfiles>=0.13 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading watchfiles-0.23.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.9 kB)\n",
      "Collecting websockets>=10.4 (from uvicorn[standard]>=0.22.0->evidently)\n",
      "  Downloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)\n",
      "Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.10/dist-packages (from anyio>=3->litestar>=2.8.3->evidently) (1.3.1)\n",
      "Requirement already satisfied: wrapt<2,>=1.10 in /usr/local/lib/python3.10/dist-packages (from deprecated>=1.2.6->opentelemetry-api>=1.25.0->evidently) (1.16.0)\n",
      "Collecting httpcore==1.* (from httpx>=0.22->litestar>=2.8.3->evidently)\n",
      "  Downloading httpcore-1.0.5-py3-none-any.whl.metadata (20 kB)\n",
      "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/dist-packages (from importlib-metadata<=8.0.0,>=6.0->opentelemetry-api>=1.25.0->evidently) (3.19.2)\n",
      "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.10/dist-packages (from markdown-it-py>=2.2.0->rich>=13->evidently) (0.1.2)\n",
      "Requirement already satisfied: six in /usr/local/lib/python3.10/dist-packages (from patsy>=0.5.6->statsmodels>=0.12.2->evidently) (1.16.0)\n",
      "Collecting faker (from polyfactory>=2.6.3->litestar>=2.8.3->evidently)\n",
      "  Downloading Faker-26.2.0-py3-none-any.whl.metadata (15 kB)\n",
      "Downloading evidently-0.4.33-py3-none-any.whl (3.4 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m4.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading dynaconf-3.2.6-py2.py3-none-any.whl (231 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m231.1/231.1 kB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading iterative_telemetry-0.0.8-py3-none-any.whl (10 kB)\n",
      "Downloading litestar-2.10.0-py3-none-any.whl (531 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m531.5/531.5 kB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading opentelemetry_api-1.26.0-py3-none-any.whl (61 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.5/61.5 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading opentelemetry_exporter_otlp_proto_grpc-1.26.0-py3-none-any.whl (18 kB)\n",
      "Downloading opentelemetry_proto-1.26.0-py3-none-any.whl (52 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m52.5/52.5 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading opentelemetry_exporter_otlp_proto_common-1.26.0-py3-none-any.whl (17 kB)\n",
      "Downloading opentelemetry_exporter_otlp_proto_http-1.26.0-py3-none-any.whl (16 kB)\n",
      "Downloading opentelemetry_sdk-1.26.0-py3-none-any.whl (109 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m109.5/109.5 kB\u001b[0m \u001b[31m5.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading opentelemetry_semantic_conventions-0.47b0-py3-none-any.whl (138 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m138.0/138.0 kB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading requests-2.32.3-py3-none-any.whl (64 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.9/64.9 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n",
      "Downloading ujson-5.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.6/53.6 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading uvicorn-0.30.5-py3-none-any.whl (62 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.8/62.8 kB\u001b[0m \u001b[31m3.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading watchdog-4.0.1-py3-none-manylinux2014_x86_64.whl (83 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m83.0/83.0 kB\u001b[0m \u001b[31m4.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n",
      "Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading httptools-0.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (341 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m341.4/341.4 kB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading httpx-0.27.0-py3-none-any.whl (75 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m4.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading httpcore-1.0.5-py3-none-any.whl (77 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading importlib_metadata-8.0.0-py3-none-any.whl (24 kB)\n",
      "Downloading msgspec-0.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (210 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m210.3/210.3 kB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n",
      "Downloading polyfactory-2.16.2-py3-none-any.whl (58 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)\n",
      "Downloading uvloop-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m9.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading watchfiles-0.23.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (427 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m427.7/427.7 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (130 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.2/130.2 kB\u001b[0m \u001b[31m8.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)\n",
      "Downloading rich_click-1.8.3-py3-none-any.whl (35 kB)\n",
      "Downloading Faker-26.2.0-py3-none-any.whl (1.8 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.8/1.8 MB\u001b[0m \u001b[31m11.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: appdirs, websockets, watchdog, uvloop, ujson, requests, python-dotenv, opentelemetry-proto, mypy-extensions, msgspec, importlib-metadata, httptools, h11, dynaconf, deprecated, watchfiles, uvicorn, typing-inspect, opentelemetry-exporter-otlp-proto-common, opentelemetry-api, iterative-telemetry, httpcore, faker, rich-click, polyfactory, opentelemetry-semantic-conventions, httpx, opentelemetry-sdk, litestar, opentelemetry-exporter-otlp-proto-http, opentelemetry-exporter-otlp-proto-grpc, evidently\n",
      "  Attempting uninstall: requests\n",
      "    Found existing installation: requests 2.31.0\n",
      "    Uninstalling requests-2.31.0:\n",
      "      Successfully uninstalled requests-2.31.0\n",
      "  Attempting uninstall: importlib-metadata\n",
      "    Found existing installation: importlib_metadata 8.2.0\n",
      "    Uninstalling importlib_metadata-8.2.0:\n",
      "      Successfully uninstalled importlib_metadata-8.2.0\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "google-colab 1.0.0 requires requests==2.31.0, but you have requests 2.32.3 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed appdirs-1.4.4 deprecated-1.2.14 dynaconf-3.2.6 evidently-0.4.33 faker-26.2.0 h11-0.14.0 httpcore-1.0.5 httptools-0.6.1 httpx-0.27.0 importlib-metadata-8.0.0 iterative-telemetry-0.0.8 litestar-2.10.0 msgspec-0.18.6 mypy-extensions-1.0.0 opentelemetry-api-1.26.0 opentelemetry-exporter-otlp-proto-common-1.26.0 opentelemetry-exporter-otlp-proto-grpc-1.26.0 opentelemetry-exporter-otlp-proto-http-1.26.0 opentelemetry-proto-1.26.0 opentelemetry-sdk-1.26.0 opentelemetry-semantic-conventions-0.47b0 polyfactory-2.16.2 python-dotenv-1.0.1 requests-2.32.3 rich-click-1.8.3 typing-inspect-0.9.0 ujson-5.10.0 uvicorn-0.30.5 uvloop-0.19.0 watchdog-4.0.1 watchfiles-0.23.0 websockets-12.0\n"
     ]
    }
   ],
   "source": [
    "# ! pip install evidently"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "jdlyp1KDQRPR",
    "outputId": "49ba6a99-b505-423a-bea3-15880bd8cd35"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting tracely\n",
      "  Obtaining dependency information for tracely from https://files.pythonhosted.org/packages/c6/e4/ae9f88a8fb4e81889d080fcf606fdc7c123bd6185b66f29b2b10b56117c2/tracely-0.1.0-py3-none-any.whl.metadata\n",
      "  Downloading tracely-0.1.0-py3-none-any.whl.metadata (905 bytes)\n",
      "Requirement already satisfied: opentelemetry-api>=1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (1.25.0)\n",
      "Requirement already satisfied: opentelemetry-exporter-otlp-proto-grpc>=1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (1.25.0)\n",
      "Requirement already satisfied: opentelemetry-exporter-otlp-proto-http>=1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (1.25.0)\n",
      "Requirement already satisfied: opentelemetry-proto>=1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (1.25.0)\n",
      "Requirement already satisfied: opentelemetry-sdk>=1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (1.25.0)\n",
      "Requirement already satisfied: requests>=2.32.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from tracely) (2.32.1)\n",
      "Requirement already satisfied: deprecated>=1.2.6 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-api>=1.25.0->tracely) (1.2.14)\n",
      "Requirement already satisfied: importlib-metadata<=7.1,>=6.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-api>=1.25.0->tracely) (6.8.0)\n",
      "Requirement already satisfied: googleapis-common-protos~=1.52 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->tracely) (1.61.0)\n",
      "Requirement already satisfied: grpcio<2.0.0,>=1.0.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->tracely) (1.65.0)\n",
      "Requirement already satisfied: opentelemetry-exporter-otlp-proto-common==1.25.0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.25.0->tracely) (1.25.0)\n",
      "Requirement already satisfied: protobuf<5.0,>=3.19 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-proto>=1.25.0->tracely) (4.25.1)\n",
      "Requirement already satisfied: opentelemetry-semantic-conventions==0.46b0 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-sdk>=1.25.0->tracely) (0.46b0)\n",
      "Requirement already satisfied: typing-extensions>=3.7.4 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from opentelemetry-sdk>=1.25.0->tracely) (4.8.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from requests>=2.32.0->tracely) (3.2.0)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from requests>=2.32.0->tracely) (3.4)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from requests>=2.32.0->tracely) (2.0.4)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from requests>=2.32.0->tracely) (2024.7.4)\n",
      "Requirement already satisfied: wrapt<2,>=1.10 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from deprecated>=1.2.6->opentelemetry-api>=1.25.0->tracely) (1.16.0)\n",
      "Requirement already satisfied: zipp>=0.5 in /opt/homebrew/Caskroom/miniconda/base/envs/py11/lib/python3.11/site-packages (from importlib-metadata<=7.1,>=6.0->opentelemetry-api>=1.25.0->tracely) (3.16.2)\n",
      "Downloading tracely-0.1.0-py3-none-any.whl (9.3 kB)\n",
      "Installing collected packages: tracely\n",
      "Successfully installed tracely-0.1.0\n"
     ]
    }
   ],
   "source": [
    "# ! pip install tracely"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "8de35rP1YsgW",
    "outputId": "e94a3fce-1485-42f8-8aec-b0da942dd3cf"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting openai\n",
      "  Downloading openai-1.40.0-py3-none-any.whl.metadata (22 kB)\n",
      "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai) (3.7.1)\n",
      "Requirement already satisfied: distro<2,>=1.7.0 in /usr/lib/python3/dist-packages (from openai) (1.7.0)\n",
      "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai) (0.27.0)\n",
      "Collecting jiter<1,>=0.4.0 (from openai)\n",
      "  Downloading jiter-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.6 kB)\n",
      "Requirement already satisfied: pydantic<3,>=1.9.0 in /usr/local/lib/python3.10/dist-packages (from openai) (2.8.2)\n",
      "Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai) (1.3.1)\n",
      "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai) (4.66.4)\n",
      "Requirement already satisfied: typing-extensions<5,>=4.11 in /usr/local/lib/python3.10/dist-packages (from openai) (4.12.2)\n",
      "Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.10/dist-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
      "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5,>=3.5.0->openai) (1.2.2)\n",
      "Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
      "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.10/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
      "Requirement already satisfied: pydantic-core==2.20.1 in /usr/local/lib/python3.10/dist-packages (from pydantic<3,>=1.9.0->openai) (2.20.1)\n",
      "Downloading openai-1.40.0-py3-none-any.whl (360 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m360.4/360.4 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading jiter-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (318 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m318.9/318.9 kB\u001b[0m \u001b[31m18.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: jiter, openai\n",
      "Successfully installed jiter-0.5.0 openai-1.40.0\n"
     ]
    }
   ],
   "source": [
    "# !pip install openai"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "id": "ObgML9bKWwHt"
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import requests\n",
    "from datetime import datetime, timedelta\n",
    "from io import BytesIO\n",
    "import openai"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "id": "6RMnRtVdShWX"
   },
   "outputs": [],
   "source": [
    "from tracely import init_tracing\n",
    "from tracely import trace_event"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "pZAi-retexB1"
   },
   "source": [
    "## Initializatin"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Evidently Cloud: create an Account, Organization, Team and get an API key: https://app.evidently.cloud/token\n",
    "\n",
    "OpenAI API key: https://platform.openai.com/api-keys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "QXffwkxIW4-C"
   },
   "outputs": [],
   "source": [
    "openai_api_key = \"YOUR_OPEN_AI_API_KEY\" # os.environ[\"OPENAI_API_KEY\"] = \"YOUR_KEY\"\n",
    "my_token = \"YOUR_EVIDENTLY_TOKEN\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "OzuQtDIFQl0R"
   },
   "outputs": [],
   "source": [
    "address=\"https://app.evidently.cloud/\"\n",
    "team_id=\"YOUR_TEAM_ID\"\n",
    "dataset_name=\"YOUR_TRACING_DATASET_NAME\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "Bgq55z04DrR6"
   },
   "source": [
    "Use ```init_tracing``` to enable tracely tracing.\n",
    "\n",
    "**Signature:** init_tracing(address: Optional[str] = None, exporter_type: Optional[str] = None, api_key: Optional[str] = None, team_id: Optional[str] = None, export_name: Optional[str] = None, *, as_global: bool = True) -> opentelemetry.trace.TracerProvider\n",
    "\n",
    "**Parameters:**\n",
    " - **address:** address of collector service\n",
    " - **exporter_type:** type of exporter to use \"grpc\" or \"http\"\n",
    " - **api_key:** authorization API key for Evidently tracing\n",
    " - **team_id:** team ID in Evidently Cloud\n",
    " * **export_name**: string name of exported data, all data with the same ID would be grouped into single dataset\n",
    " - **as_global:** indicated when to register provider globally for opentelemetry or use local one"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "90VZkLKJdLgr",
    "outputId": "960d7682-aaec-455b-e75f-6de8d9cc5f86"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING:opentelemetry.trace:Overriding of current TracerProvider is not allowed\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<opentelemetry.sdk.trace.TracerProvider at 0x7f579546bd60>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "init_tracing(\n",
    "    address=address,\n",
    "    api_key=my_token,\n",
    "    team_id=team_id,\n",
    "    export_name=dataset_name\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "vC1ElEsGWnWY"
   },
   "source": [
    "## Tracing simple example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "eOhYMekJZFsL"
   },
   "outputs": [],
   "source": [
    "client = openai.OpenAI(api_key=openai_api_key)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "25FqZsr-a3bc"
   },
   "outputs": [],
   "source": [
    "question_list = [\n",
    "    \"What are the main differences between climate change and global warming?\",\n",
    "    \"What are the key principles of quantum mechanics?\",\n",
    "    \"Can you explain the theory of relativity in simple terms?\",\n",
    "    \"How do vaccines work?\",\n",
    "    \"What is blockchain technology and how does it work?\",\n",
    "    \"What are the potential benefits and risks of artificial intelligence?\",\n",
    "    \"What are the distinguishing features of Baroque art?\",\n",
    "    \"What are some effective ways to manage stress?\",\n",
    "    \"What is the difference between stocks and bonds?\",\n",
    "    \"Can you explain the concept of cryptocurrency and how it works?\",\n",
    "\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "AWsT3tC8ZOFR"
   },
   "outputs": [],
   "source": [
    "question_prompt = \"\"\"\n",
    "Please answer the following question nicely with a clear structure of response and some conclusions at the end.\n",
    "\n",
    "Here is a question: {{text_input}}\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "o-VxVKuRe1aP"
   },
   "source": [
    "To trace a function call use ```trace_event()``` decorator\n",
    "\n",
    "**Signature:**\n",
    "\n",
    "trace_event(span_name: Optional[str] = None, track_args: Optional[List[str]] = None, ignore_args: Optional[List[str]] = None, track_output: Optional[bool] = True)\n",
    "\n",
    "**Parameters:**\n",
    "  *  **span_name:** the name of the span to track as.\n",
    "  * **track_args:** list of arguments to capture, if set to None - capture all arguments (default), if set to [] do not capture any arguments\n",
    "  * **ignore_args:** list of arguments to ignore, if set to None - do not ignore any arguments.\n",
    "  * **track_output:** track the output of the function call\n",
    "\n",
    "**Common cases:**\n",
    "- ```@trace_event()``` - log all arguments of the function\n",
    "- ```@trace_event(track_args=[])``` - log only input arguments of the function\n",
    "- ```@trace_event(track_args=[\"arg1\", \"arg2\"])``` - log only \"arg1\" and \"arg2\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "OgD3SoE3ZLOf"
   },
   "outputs": [],
   "source": [
    "@trace_event()\n",
    "def pseudo_assistant(prompt, question):\n",
    "  model = \"gpt-4o-mini\"\n",
    "  system_prompt = \"You are a nice and helpful assistant \"\n",
    "  user_prompt = prompt.replace(\"{{text_input}}\", question)\n",
    "\n",
    "  choices = client.chat.completions.create(\n",
    "    model=model,\n",
    "    messages=[\n",
    "      {\"role\": \"system\", \"content\": system_prompt},\n",
    "      {\"role\": \"user\", \"content\": user_prompt},\n",
    "    ]\n",
    "  )\n",
    "\n",
    "  response = choices.choices[0].message.content\n",
    "\n",
    "  return response"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "8bZdBf0OasPA"
   },
   "outputs": [],
   "source": [
    "for question in question_list:\n",
    "   pseudo_assistant(prompt=question_prompt, question=question)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "OgfgLaTTfYHa"
   },
   "source": [
    "## Load traced data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "9sO2rqbPlygs"
   },
   "outputs": [],
   "source": [
    "from evidently.ui.workspace.cloud import CloudWorkspace\n",
    "\n",
    "from evidently.report import Report\n",
    "\n",
    "from evidently import metrics\n",
    "from evidently.metric_preset import DataQualityPreset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "85QNaBYLkPYe"
   },
   "outputs": [],
   "source": [
    "ws = CloudWorkspace(token=my_token, url=address)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "toWxVFnijsr9"
   },
   "outputs": [],
   "source": [
    "dataset_id = \"YOUR_DATASET_ID\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 487
    },
    "id": "bI3Q32qDfazA",
    "outputId": "b02d273c-67e4-4a77-ed0e-7c6e7e6acc5f"
   },
   "outputs": [
    {
     "data": {
      "application/vnd.google.colaboratory.intrinsic+json": {
       "summary": "{\n  \"name\": \"traced_data\",\n  \"rows\": 21,\n  \"fields\": [\n    {\n      \"column\": \"id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 21,\n        \"samples\": [\n          \"032f4bb7-b776-2e81-0d48-22081f686817\",\n          \"d41f13a3-06df-34b0-0340-5c89822b9fb1\",\n          \"c4a3d206-e8f1-1567-e115-a4543f1efaf2\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"service_name\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 1,\n        \"samples\": [\n          \"unknown_service\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"timestamp\",\n      \"properties\": {\n        \"dtype\": \"date\",\n        \"min\": \"2024-08-06 11:31:16.790639\",\n        \"max\": \"2024-08-06 14:53:41.643676\",\n        \"num_unique_values\": 21,\n        \"samples\": [\n          \"2024-08-06 14:53:09.968997\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"pseudo_assistant.prompt\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"\\nPlease answer the following question nicely with a clear structure of a responce and some conclusions at the end.\\n\\nHere is a question: {{text_input}}.\\n\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"pseudo_assistant.question\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"What are some effective ways to manage stress?\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"pseudo_assistant.result\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 19,\n        \"samples\": [\n          \"Baroque art, which flourished from the late 16th century to the early 18th century, is renowned for its dramatic expression, intricate details, and emotional intensity. Below, I outline the key distinguishing features of Baroque art:\\n\\n### 1. **Dramatic Use of Light and Shadow (Chiaroscuro)**\\n   - Baroque artists often employed a technique known as chiaroscuro, which involves the striking contrast between light and dark. This technique helps to create a sense of depth and volume in their compositions.\\n   - **Examples:** Caravaggio famously utilized this method, illuminating subjects with a stark, focused light, which drew attention to their emotions and actions.\\n\\n### 2. **Dynamic Composition**\\n   - Baroque artworks frequently feature dynamic and swirling forms, creating a sense of movement. This sense of action draws the viewer's eye across the canvas.\\n   - Artists often arranged figures and elements in diagonal lines, enhancing the overall dynamism of the scene.\\n   - **Examples:** The works of Peter Paul Rubens are characterized by such lively, active compositions.\\n\\n### 3. **Emotional Intensity**\\n   - Baroque art seeks to evoke strong emotional responses from the viewer. This is achieved through expressive facial features, body language, and dramatic narratives.\\n   - The subjects in Baroque paintings often exhibit intense emotions, immersing the viewer in the artwork\\u2019s story.\\n   - **Examples:** Gian Lorenzo Bernini's sculptures convey a palpable sense of passion and spirituality, exemplifying this emotional intensity.\\n\\n### 4. **Rich Color Palette and Textures**\\n   - The color schemes of Baroque art are typically vibrant, using deep, rich hues to create a sense of opulence. These colors enhance the drama and emotional impact of the artwork.\\n   - Textures are often rendered to imitate materials such as fabric, skin, or stone, adding to the artwork's realism and visual allure.\\n   - **Examples:** Artists like Rembrandt utilized rich colors and textures in their portraits, making them more lifelike and engaging.\\n\\n### 5. **Thematic Diversity**\\n   - Baroque art encompasses a wide range of themes, including religious, mythological, and allegorical subjects. Artists often portrayed grand narratives, historical events, and everyday life.\\n   - The themes frequently appealed to personal devotion, as seen in religious art that aimed at inspiring faith and contemplation.\\n   - **Examples:** The works of Artemisia Gentileschi often depict strong female figures from biblical and mythological stories, showcasing both personal and universal themes.\\n\\n### 6. **Integration of Arts**\\n   - Baroque art often blends various artistic disciplines, including painting, sculpture, and architecture, to create cohesive spaces and experiences. This holistic approach was particularly evident in grand architectural projects, like St. Peter's Basilica in Rome.\\n   - **Examples:** Lorenzo Bernini's work on the colonnade at St. Peter\\u2019s highlights the collaboration between sculpture and architecture.\\n\\n### Conclusions\\nIn summary, Baroque art is characterized by its dramatic effects, emotional depth, and intricate detail, combined with a dynamic composition and rich color palettes. The interplay of light and shadow enhances the viewer's experience, while the diverse themes reflect the artistic and cultural aspirations of the era. The Baroque period represents a departure from the calm rationality of the Renaissance, offering an exhilarating blend of art that continues to captivate audiences today. Through its intensity and drama, Baroque art not only influenced subsequent artistic movements but also left an indelible mark on the cultural landscape of Europe and beyond.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"pseudo_assistant.exception\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 1,\n        \"samples\": [\n          \"local variable 'response' referenced before assignment\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
       "type": "dataframe",
       "variable_name": "traced_data"
      },
      "text/html": [
       "\n",
       "  <div id=\"df-d77a3863-965f-4b53-a60b-f4e03a612ef7\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>service_name</th>\n",
       "      <th>timestamp</th>\n",
       "      <th>pseudo_assistant.prompt</th>\n",
       "      <th>pseudo_assistant.question</th>\n",
       "      <th>pseudo_assistant.result</th>\n",
       "      <th>pseudo_assistant.exception</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>032f4bb7-b776-2e81-0d48-22081f686817</td>\n",
       "      <td>unknown_service</td>\n",
       "      <td>2024-08-06 14:53:09.968997</td>\n",
       "      <td>\\nPlease answer the following question nicely ...</td>\n",
       "      <td>What are the distinguishing features of Baroqu...</td>\n",
       "      <td>Baroque art, which flourished from the late 16...</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0888f342-7ef6-3561-6600-b3d7f4476378</td>\n",
       "      <td>unknown_service</td>\n",
       "      <td>2024-08-06 14:52:36.765640</td>\n",
       "      <td>\\nPlease answer the following question nicely ...</td>\n",
       "      <td>How do vaccines work?</td>\n",
       "      <td>Vaccines are an essential tool in public healt...</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0a390bc5-7d1b-3c68-5b75-36724252fe9a</td>\n",
       "      <td>unknown_service</td>\n",
       "      <td>2024-08-06 11:34:06.701821</td>\n",
       "      <td>\\nPlease answer the following question nicely ...</td>\n",
       "      <td>What are the main differences between climate ...</td>\n",
       "      <td>Certainly! Let’s explore the key differences b...</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0dc7bed7-4f53-5f57-f411-b0b29a169626</td>\n",
       "      <td>unknown_service</td>\n",
       "      <td>2024-08-06 14:52:56.647948</td>\n",
       "      <td>\\nPlease answer the following question nicely ...</td>\n",
       "      <td>What are the potential benefits and risks of a...</td>\n",
       "      <td>**Question: What are the potential benefits an...</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>24406289-b034-5075-b4d0-b185330c3704</td>\n",
       "      <td>unknown_service</td>\n",
       "      <td>2024-08-06 14:52:25.939959</td>\n",
       "      <td>\\nPlease answer the following question nicely ...</td>\n",
       "      <td>Can you explain the theory of relativity in si...</td>\n",
       "      <td>Certainly! The theory of relativity, proposed ...</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d77a3863-965f-4b53-a60b-f4e03a612ef7')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-d77a3863-965f-4b53-a60b-f4e03a612ef7 button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-d77a3863-965f-4b53-a60b-f4e03a612ef7');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-12937fc7-02d8-4527-9b85-b7b6734b21ce\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-12937fc7-02d8-4527-9b85-b7b6734b21ce')\"\n",
       "            title=\"Suggest charts\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-12937fc7-02d8-4527-9b85-b7b6734b21ce button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "                                     id     service_name  \\\n",
       "0  032f4bb7-b776-2e81-0d48-22081f686817  unknown_service   \n",
       "1  0888f342-7ef6-3561-6600-b3d7f4476378  unknown_service   \n",
       "2  0a390bc5-7d1b-3c68-5b75-36724252fe9a  unknown_service   \n",
       "3  0dc7bed7-4f53-5f57-f411-b0b29a169626  unknown_service   \n",
       "4  24406289-b034-5075-b4d0-b185330c3704  unknown_service   \n",
       "\n",
       "                   timestamp  \\\n",
       "0 2024-08-06 14:53:09.968997   \n",
       "1 2024-08-06 14:52:36.765640   \n",
       "2 2024-08-06 11:34:06.701821   \n",
       "3 2024-08-06 14:52:56.647948   \n",
       "4 2024-08-06 14:52:25.939959   \n",
       "\n",
       "                             pseudo_assistant.prompt  \\\n",
       "0  \\nPlease answer the following question nicely ...   \n",
       "1  \\nPlease answer the following question nicely ...   \n",
       "2  \\nPlease answer the following question nicely ...   \n",
       "3  \\nPlease answer the following question nicely ...   \n",
       "4  \\nPlease answer the following question nicely ...   \n",
       "\n",
       "                           pseudo_assistant.question  \\\n",
       "0  What are the distinguishing features of Baroqu...   \n",
       "1                              How do vaccines work?   \n",
       "2  What are the main differences between climate ...   \n",
       "3  What are the potential benefits and risks of a...   \n",
       "4  Can you explain the theory of relativity in si...   \n",
       "\n",
       "                             pseudo_assistant.result  \\\n",
       "0  Baroque art, which flourished from the late 16...   \n",
       "1  Vaccines are an essential tool in public healt...   \n",
       "2  Certainly! Let’s explore the key differences b...   \n",
       "3  **Question: What are the potential benefits an...   \n",
       "4  Certainly! The theory of relativity, proposed ...   \n",
       "\n",
       "  pseudo_assistant.exception  \n",
       "0                       None  \n",
       "1                       None  \n",
       "2                       None  \n",
       "3                       None  \n",
       "4                       None  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "traced_data = ws.load_dataset(dataset_id = dataset_id)\n",
    "traced_data.head()"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
